<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台分类管理</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__css/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="__ADMIN__css/animate.min.css" rel="stylesheet">
    <link href="__ADMIN__css/style.min.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/default/layer.css" rel="stylesheet">
    <link rel="stylesheet" href="__ADMIN__css/plugins/switchery/switchery.css" />
</head>
<body>
<div class="col-sm-12">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>添加分类</h5>
        </div>
        <div class="ibox-content">
            <form method="post" action="{:U('art/save')}" id="artfrom" name="artfrom" class="form-horizontal">
                <input type="hidden" name="id" value="{$art.id}">
                <input type="hidden" name="pid" value="{$art.pid}">
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">栏目名称</label>

                    <div class="col-sm-10">
                        <input type="text" name="artname" value="{$art.title}" id="artname" placeholder="请输入栏目名称" class="form-control">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>

                    <div class="col-sm-10">
                        <input type="text" name="sort" value="{$art.sort}" id="sort" placeholder="请输入排序" class="form-control">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">关键词</label>

                    <div class="col-sm-10">
                        <input type="text" value="{$art.keyword}" name="keyword" id="keyword" placeholder="请输入关键词" class="form-control">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">描述</label>

                    <div class="col-sm-10">
                        <input type="text" name="description" value="{$art.description}" id="description" placeholder="请输入描述" class="form-control">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>

                    <div class="col-sm-10">
                        <input type="checkbox" name="status" id="status" value="1" class="js-switch" <if condition="$art['status'] eq 1"> checked </if>>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="col-sm-4 col-sm-offset-2">
                    <button class="btn btn-primary" type="submit">保存内容</button>
                    <button class="btn btn-white" type="reset" onclick="history.go(-1)">取消</button>
                </div>
            </form>

        </div>
    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.min.js"></script>
<script src="__ADMIN__js/plugins/switchery/switchery.js"></script>
<script src="__ADMIN__js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ADMIN__js/plugins/validate/messages_zh.min.js"></script>
<script src="__ADMIN__js/jquery.form.js"></script>
<script src="__ADMIN__js/common.js"></script>
</body>
<script>
    $(function(){
        $("#artfrom").ajaxForm({
            beforeSerialize: changeValue,//在提交之前执行此项
            beforeSubmit:checkForm,
            success:complete,
            dataType:'JSON',
            clearForm:true
        });
        function complete(data){
            if(data.status > 0){
                common.error(data.msg);
            }else{
                common.success(data.msg,'{:U("art/index")}');
            }
        }
        function checkForm(formData, jqForm, options){

        }
        function changeValue(){
            var name = $('#artname').val();
            if(name == ''){
                common.error('请输入栏目名称');
                return false;
            }
            var title = $('#keyword').val();
            if(title == ''){
                common.error('请输入关键词');
                return false;
            }
        }
    });
    var elem = document.querySelector('.js-switch');
    var switchery = new Switchery(elem, { });

</script>
</html>
